#ifndef COMMONPAGE_H
#define COMMONPAGE_H

#include <QWidget>
#include "musiclist.h"
#include<QMediaPlaylist>

namespace Ui {
class CommonPage;
}
enum PageType
{
    LIKE_PAGE = 1,
    LOCAL_PAGE,
    HISTORY_PAGE
};

class CommonPage : public QWidget
{
    Q_OBJECT

public:
    explicit CommonPage(QWidget *parent = nullptr);
    ~CommonPage();
    void setCommonPageUI(const QString& title, const QString& image);
private:
   // void enterEvent(QEvent *event) override;
   // void leaveEvent(QEvent *event) override;
void addMusicToMusicPage(MusicList &musicList);
public:
        PageType pagetype;
    QVector<QString> musicListOfPage;
void setMusicListType(PageType pageType);
void reFresh(MusicList& musicList);
void addMusicToPlayer(MusicList& musicList,QMediaPlaylist* playlist);
 const QString& getMusicIdByIndex(int index)const;

 void setImageLabel(QPixmap pixMap);
signals:
    void updateLikeMusic(bool isLike, QString musicId);
    void playAll(PageType pagetype);
    void playMusicByIndex(CommonPage* page,int row);


private:
    Ui::CommonPage *ui;
};

#endif // COMMONPAGE_H
